# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=turnstile
pkgver=0.1.8
pkgrel=0
pkgdesc="Independent session/login tracker"
url="https://github.com/chimera-linux/turnstile"
arch="all"
license="BSD-2-Clause"
makedepends="
	linux-pam-dev
	meson
	scdoc
	"
subpackages="$pkgname-doc $pkgname-openrc"
source="$pkgname-$pkgver.tar.gz::https://github.com/chimera-linux/turnstile/archive/refs/tags/v$pkgver.tar.gz
	turnstiled.confd
	turnstiled.initd
	"
options="!check" # no tests

build() {
	abuild-meson \
		-Db_lto=true \
		-Ddinit=disabled \
		-Dmanage_rundir=true \
		. output
	meson compile -C output
}


package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output

	install -Dm755 "$srcdir"/turnstiled.initd "$pkgdir"/etc/init.d/turnstiled
	install -Dm644 "$srcdir"/turnstiled.confd "$pkgdir"/etc/conf.d/turnstiled
}

sha512sums="
f6fee2056707b480d0345c86c3fe0c81e00ad09f54e7b7ca447e805deef47a08a4ae05540a2f57c45d6253ee99d8c2fcf1e6e5f6cd7135dfca1941589271d726  turnstile-0.1.8.tar.gz
4798d04b707e3b44467c1e75481a5123dbf4755ef1bdd09ac31d180762f67085a7030c4ba7d1f27b1ef30910785d8739375a730f32647c7d554142fac4d6b824  turnstiled.confd
4824f233704b21e3a4ab931879f88ec716761065fd109038ea9a0c89383580c7a198e2372088b555cb894110b5067c26b99ac9c40c04bf9a2384af1417fa4ad0  turnstiled.initd
"
